﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using HandyControl.Collections;
using HandyControl.Controls;

namespace weighing
{
    /// <summary>
    /// PermissionWindow.xaml 的交互逻辑
    /// </summary>
    public partial class PermissionWindow : GlowWindow
    {
        #region variables
        List<PermissionVo>? mPermissionVos;
        #endregion
        public PermissionWindow()
        {
            InitializeComponent();

            CommonFunction.ShowCustomIcon(this);
        }
       

        #region
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {

        }
        private void Window_ContentRendered(object sender, EventArgs e)
        {
            LoadData();
        }

        private void Window_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
        {
            if (e.Key == Key.Escape) this.Close();
        }
        #endregion

        private void LoadData()
        {
            var list = PermissionDao.Instance.SelectAll();
            mPermissionVos = list.Select((i) => { return new PermissionVo(i); }).ToList();
            this.DataLv.ItemsSource = mPermissionVos;
        }

        private void AddBtn_Click(object sender, RoutedEventArgs e)
        {
        }

        private void RefreshBtn_Click(object sender, RoutedEventArgs e)
        {
            this.LoadData();
        }

       
    }
}
